/*
/*
 * Created on Feb 8, 2004
 *
 * To change the template for this generated file go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
package littlecyberwar.ui;

import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;


import littlecyberwar.model.*;
import littlecyberwar.ui.*;
import littlecyberwar.util.*;
import littlecyberwar.tool.MouseHandler;
/**
 * @author Milton  Soong
 *
 * To change the template for this generated type comment go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
public class ResetMoveAction extends LCWAction { 
	InternalCmdFacade mod;
	
  public ResetMoveAction(String text, ImageIcon icon,
					String desc, KeyStroke k, MainFrame fr) {
	  super(text, icon, desc, k, fr);
	  mod = fr.getIcmd();
  }
	
	/**
	 * Put up a warning dialog stating that all movement distance will be whacked.
	 * Do you want to do it (ok or cancel)
	 * if OK then generate event for internal cmd facade
	 */
	public void actionPerformed(ActionEvent e) {
 
		int n = JOptionPane.showConfirmDialog(frame,
					"You want to reset the Distance Moved\n" +					"field for ALL units in the game?\n",
					"Reset All Units",
						JOptionPane.YES_NO_OPTION);
		if (n == JOptionPane.YES_OPTION) {
			GameStateCommand cmd = new GameStateCommand(GameStateCommand._SUBCMD_RESET_ALL_MOV_DISTANCE);
			cmd.setPlayerName(Players.getSelfName());
			mod.addCmd(cmd);
		} 

  	}
}


